package cn.bgs.entity;

import cn.bgs.utils.dateUtils;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
@Getter
@Setter
@TableName(value = "student")
public class Student {
    @TableId(value = "stu_id",type = IdType.INPUT)
    private Integer stuId;

    private String stuNum;

    private String stuName;

    private String mobile;

    private String sex;

    private Integer age;

    private String idType;

    private String idNum;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    private Integer deleteFlage;

    private String nativePlace;

    private String provincesId;

    private String citiesId;

    private String areasId;

    private String detailAddr;

    @TableField(fill = FieldFill.INSERT)
    private Date createDatee;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateDate;

    private String remark;

    private Integer classId;

    private Integer dormitoryId;

    private String email;

    private String password;

    private String photo;


    public Integer getAge() {

        Integer age1 = 0;

        try {
            age1 = dateUtils.getAge(birthday);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return age1;
    }

    public void setAge(Integer age) {
        this.age = age;
    }



}